﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ComputerGraphics.Graphics
{
    public class ColorTriple
    {
        private double r;
        private double g;
        private double b;

        public static implicit operator ColorTriple(int x)
        {
            return new ColorTriple(x, x, x);
        }

        public static ColorTriple operator +(ColorTriple a, ColorTriple b)
        {
            return new ColorTriple(a.r + b.r, a.g + b.g, a.b + b.b);
        }

        public static ColorTriple operator *(ColorTriple a, double scale)
        {
            return new ColorTriple(a.r * scale, a.g * scale, a.b * scale);
        }

        public static ColorTriple operator *(ColorTriple a, ColorTriple b)
        {
            return new ColorTriple(a.r * b.r, a.g * b.g, a.b * b.b);
        }

        public static ColorTriple operator *(double scale, ColorTriple a)
        {
            return a * scale;
        }

        public ColorTriple(double r, double g, double b)
        {
            this.r = r;
            this.g = g;
            this.b = b;
        }

        public double Red
        {
            get { return r; }
        }

        public double Green
        {
            get { return g; }
        }

        public double Blue
        {
            get { return b; }
        }
    }
}
